package com.none.web.service.book;

import java.util.List;
import java.util.Map;

import com.none.web.model.TBookinfo;
import com.none.core.model.Pager;

public interface IBookAppService {
	/**
	 * app查询书籍列表
	 * @param pager
	 * @param keywords  以”Book title”、”Book Author”以及”Serial NO”为搜索条件
	 * @param category
	 * @param userId
	 * @return
	 * @throws Exception
	 */
	List<TBookinfo> queryBookList(Pager pager,String keywords,String category,String userName) throws Exception;
	/**
	 * 获取某一本书的详情
	 * @param bookId
	 * @param userId
	 * @return
	 * @throws Exception
	 */
	TBookinfo getDetailInfo(Integer bookId,String userName) throws Exception;
	/**
	 * 获取预约取书的日期（取四个）
	 * @param currentTime 当前时间
	 * @return
	 * @throws Exception
	 */
	Map<String,Object> getPickUpDate(String currentTime,String userName) throws Exception;
	
	/**
	 * 增加预约记录
	 * @param book_mgrNo
	 * @param phone
	 * @param pickupday
	 * @param userName
	 * @return
	 * @throws Exception
	 */
	Map<String,Object> addBorrowBook(String book_mgrNo,String phone,String pickupday,String userName) throws Exception;
	/**
	 * 增加预约记录后查看信息
	 * @param book_mgrNo
	 * @param bookId
	 * @param borrowId
	 * @param userName
	 * @return
	 * @throws Exception
	 */
	Map<String,Object> viewBorrowBook(String book_mgrNo,Integer bookId,String borrowId,String userName) throws Exception; 
	
	/**
	 * 取消预约记录
	 * @param book_mgrNo
	 * @param bookId
	 * @param borrowId
	 * @param userName
	 * @return
	 * @throws Exception
	 */
	boolean saveCancelBorrowBook(String book_mgrNo,Integer bookId,String borrowId,String userName) throws Exception; 
	
	
	/**
	 * 读取二维码并解密
	 * @param content
	 * @param userName
	 * @return
	 * @throws Exception
	 */
	Map<String,Object> readBorrowBook(String content,String userName) throws Exception; 
	
	
	/**
	 * 取书
	 * @param book_mgrNo
	 * @param bookId
	 * @param borrowId
	 * @param userName
	 * @return
	 * @throws Exception
	 */
	Map<String,Object> saveCheckOutBook(String book_mgrNo,Integer bookId,String borrowId,String borrower,String userName) throws Exception; 
	
	/**
	 * 还书
	 * @param book_mgrNo
	 * @param bookId
	 * @param borrowId
	 * @param userName
	 * @return
	 * @throws Exception
	 */
	Map<String,Object> saveCheckInBook(String book_mgrNo,Integer bookId,String borrowId,String borrower,String userName) throws Exception; 
	
	/**
	 * 续借
	 * @param book_mgrNo
	 * @param bookId
	 * @param borrowId
	 * @param userName
	 * @return
	 * @throws Exception
	 */
	Map<String,Object> saveRenewBook(String book_mgrNo,Integer bookId,String borrowId,String userName) throws Exception; 
	
	
	/**
	 * 获取当前的书
	 * @param userName
	 * @return
	 * @throws Exception
	 */
	Map<String,Object> getMycurrentBook(String userName) throws Exception; 
	/**
	 * 没有可以借的书的时候，保存推送记录
	 * @param userName
	 * @return
	 * @throws Exception
	 */
	boolean saveReminderNoBook(String book_mgrNo,String userName) throws Exception;
	/**
	 * 没有书要推送
	 * @throws Exception
	 */
	void savePushReminder(Integer bookId) throws Exception;
	/**
	 * 一个是到期还书前7天提醒用户还书或者renew，一个是过期还书后1天提醒用户书已经过期了
	 * 1、到期前7天和过期后1天，这个天数做成可配置的；
	 * 2、在中午12点推送提醒；
	 * 3、用户点击推送信息自动导航到borrow record页面。
	 * @throws Exception
	 */
	void pushBeforeDueOrAfterDue() throws Exception;
	
	/**
	 * 取消预约之后，将对应的记录中的二维码字段置空，并删除对应的图片
	 * 该方法要定时执行
	 * @throws Exception
	 */
	void deleteQRImageAfterCancel() throws Exception;
	/**
	 * check out或check in之前判断
	 * @param userName
	 * @param type   in or out
	 * @return
	 * @throws Exception
	 */
	boolean checkStatus(String book_mgrNo,Integer bookId, String borrowId, String userName, String type) throws Exception;
}
